package com.vanguard.webservice.impl;

import com.vanguard.domain.User;
import com.vanguard.repository.UserRepository;
import com.vanguard.webservice.WebServiceManage;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Title: 用户业务实现
 * @Description:
 * @Author: vanguard
 * @Version: 1.0
 * @Date: 2019/02/12
 */
@javax.jws.WebService(targetNamespace="http://webservice.vanguard.com/",endpointInterface = "com.vanguard.webservice.WebServiceManage")
public class WebServiceManageImpl implements WebServiceManage {

    @Autowired
    private UserRepository userRepository;

    @Override
    public void save(User user) {
        userRepository.save(user);
    }

    @Override
    public void delete(Long id) {
        userRepository.deleteById(id);
    }

    @Override
    public User getById(Long id) {
        User user = userRepository.findById(id).get();
        return user;
    }

    @Override
    public List<User> findList() {
        List<User> userList = userRepository.findAll();
        return userList;
    }
}
